<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="_meta :: header">
    <title>编辑</title>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form form form-horizontal" id="form-scoreInfo-edit" action="#"
              th:action="@{/admin/scoreInfo/edit}"
              th:object="${scoreInfo}" enctype="multipart/form-data">
            <input type="hidden" name="id" th:value="${scoreInfo.id}"/>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="x-red">*</span>考试编号：</label>
                            <div class="layui-input-inline">
<!--                                    <input type="text" class="layui-input"-->
<!--                                           th:value="${scoreInfo.examId}"-->
<!--                                           name="examId" placeholder="修改考试编号"-->
<!--                                           id="examId"/>-->

                                <select name="examId" id="examId" lay-search th:field="${scoreInfo.examId}">
                                    <option value="">搜索考试编号</option>
                                    <option th:each="exam:${examList}"
                                            th:text="${exam.examName}" th:value="${exam.id}"></option>
                                </select>


                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="x-red">*</span>班级：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${scoreInfo.grade}"
                                           name="grade" placeholder="修改班级"
                                           id="grade"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="x-red">*</span>学生姓名：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${scoreInfo.name}"
                                           name="name" placeholder="修改学生姓名"
                                           id="name"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="x-red">*</span>考场编号：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${scoreInfo.room}"
                                           name="room" placeholder="修改考场编号"
                                           id="room"/>


                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="x-red">*</span>语文成绩：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${scoreInfo.chinese}"
                                           name="chinese" placeholder="修改语文成绩"
                                           id="chinese"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="x-red">*</span>数学成绩：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${scoreInfo.math}"
                                           name="math" placeholder="修改数学成绩"
                                           id="math"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="x-red">*</span>英语成绩：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${scoreInfo.english}"
                                           name="english" placeholder="修改英语成绩"
                                           id="english"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="x-red">*</span>文科综合：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${scoreInfo.wenSum}"
                                           name="wenSum" placeholder="修改文科综合"
                                           id="wenSum"/>

                            </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                    class="x-red">*</span>理科综合：</label>
                            <div class="layui-input-inline">
                                    <input type="text" class="layui-input"
                                           th:value="${scoreInfo.liSum}"
                                           name="liSum" placeholder="修改理科综合"
                                           id="liSum"/>

                            </div>
                    </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                </label>
                <button class="layui-btn" id="subbtn" type="submit">
                    增加
                </button>
                <button class="layui-btn" id="reset" type="reset">
                    重置
                </button>
            </div>
        </form>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<div th:replace="_footer :: footerjs"></div>
<div th:replace="_ueditor :: ueditor"></div>
<!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script>
    layui.use(['form', 'layer', 'laydate'], function () {
        $ = layui.jquery;
        var form = layui.form,
            laydate = layui.laydate,
            layer = layui.layer;
        lay('.timeSpace').each(function () {
            laydate.render({
                elem: this
                , trigger: 'click'
                , type: 'datetime'
            });
        });
    });
    $(function () {
        $("#form-scoreInfo-edit").validate({
            rules: {
        examId:
        {
            required: true,
        }
    ,
        grade:
        {
            required: true,
        }
    ,
        name:
        {
            required: true,
        }
    ,
        room:
        {
            required: true,
        }
    ,
        chinese:
        {
            required: true,
        }
    ,
        math:
        {
            required: true,
        }
    ,
        english:
        {
            required: true,
        }
    ,
        wenSum:
        {
            required: true,
        }
    ,
        liSum:
        {
            required: true,
        }
    ,
    },onkeyup:false,
            debug:true,
            success:"valid",
            submitHandler:function (form) {
            $(form).ajaxSubmit({
                type: 'POST',
                url: "/admin/scoreInfo/edit",
                success: function (data) {
                    if (data.code == "1") {
                        selfmsg('编辑成功!', 1, function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.location.reload();
                            parent.layer.close(index);
                        });
                    } else {
                        selfmsg('编辑失败!');
                    }
                },
                error: function () {
                    selfmsg('编辑异常!', 5);
                }
            });
        }
    })
        ;
    });

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>